package org.emample

object jc {
  def main(args: Array[String]): Unit = {
    var b1=new by1();
    var b2=new by2();
    b1.cu()
    b1.info()
  }

}


abstract class by{
  val name: String;
  val sr="2023";
  def info();
  def cu(): Unit = {
    print("信息如下")
  }
}

class by1 extends by{
  val name: String = "che1"
  override val sr: String = "2024"
  def info(): Unit = {
    printf(s"车名：$name,生产日期：$sr")
  }
  override def cu(): Unit = {
    print(name+"信息如下");
  }
}

class by2 extends by{
  val name="che2";
  override val sr: String = "2022";
  def info(): Unit = {
    printf(s"车名：$name,生产日期：$sr")
  }

  override def cu(): Unit = {
    print(sr)
  }
}
